﻿Imports System.Data.SqlClient

Public Class cCaseIncome

    Dim con As New SqlConnection(strcon)

    Public Function insert_CaseIncome(ByVal CaseID As Object, ByVal ContractID As Object, ByVal IncomeDate As DateTime, ByVal Description As String, ByVal Amount As Double) As Boolean
        Dim rv As Boolean = True
        Dim cmd As New SqlCommand
        cmd.CommandText = "INSERT INTO tblCaseIncome(CaseID,ContractID,IncomeDate,[Description],Amount) VALUES(@CaseID,@ContractID,@IncomeDate,@Description,@Amount)"
        With cmd.Parameters
            .AddWithValue("@CaseID", CaseID)
            .AddWithValue("@ContractID", ContractID)
            .AddWithValue("@IncomeDate", IncomeDate)
            .AddWithValue("@Description", Description)
            .AddWithValue("@Amount", Amount)
        End With
        cmd.Connection = con
        Try
            con.Open()
            cmd.ExecuteNonQuery()
        Catch ex As Exception
            rv = False
        Finally
            con.Close()
            cmd.Dispose()
        End Try
        Return rv
    End Function

End Class
